package com.group9.handinhand.service.so;

import java.util.Arrays;

import org.apache.commons.lang.ArrayUtils;

import com.group9.handinhand.dao.model.SocialUser;
/**
 * Class for service of social user
 *
 */
public class SocialUserSO extends AbstractBaseSO {

	private UserSO user;
	private String providerId;
	private String providerUserId;
	private int rank;
	private String displayName;
	private String profileUrl;
	private String imageUrl;
	private String accessToken;
	private String secret;
	private String refreshToken;
	private long expireTime;
	/**
	 * converts to social user model object
	 * @param ignoreProperties
	 * @return
	 */
	public SocialUser convertToModelObject(String... ignoreProperties) {
		SocialUser model = (SocialUser) convert(new SocialUser(), 
			(String[]) ArrayUtils.addAll(ignoreProperties, new String[]{"user"}));
		if( ! Arrays.asList(ignoreProperties).contains("user"))
			if(user != null)
				model.setUser(user.convertToModelObject(new String[]{"socialUsers"}));
		return model;
	}
	
	public UserSO getUser() {
		return user;
	}

	public void setUser(UserSO user) {
		this.user = user;
	}

	public String getProviderId() {
		return providerId;
	}

	public void setProviderId(String providerId) {
		this.providerId = providerId;
	}

	public String getProviderUserId() {
		return providerUserId;
	}

	public void setProviderUserId(String providerUserId) {
		this.providerUserId = providerUserId;
	}

	public int getRank() {
		return rank;
	}

	public void setRank(int rank) {
		this.rank = rank;
	}

	public String getDisplayName() {
		return displayName;
	}

	public void setDisplayName(String displayName) {
		this.displayName = displayName;
	}

	public String getProfileUrl() {
		return profileUrl;
	}

	public void setProfileUrl(String profileUrl) {
		this.profileUrl = profileUrl;
	}

	public String getImageUrl() {
		return imageUrl;
	}

	public void setImageUrl(String imageUrl) {
		this.imageUrl = imageUrl;
	}

	public String getAccessToken() {
		return accessToken;
	}

	public void setAccessToken(String accessToken) {
		this.accessToken = accessToken;
	}

	public String getSecret() {
		return secret;
	}

	public void setSecret(String secret) {
		this.secret = secret;
	}

	public String getRefreshToken() {
		return refreshToken;
	}

	public void setRefreshToken(String refreshToken) {
		this.refreshToken = refreshToken;
	}

	public long getExpireTime() {
		return expireTime;
	}

	public void setExpireTime(long expireTime) {
		this.expireTime = expireTime;
	}

}
